This page last changed on Jun 02, 2006 by stephen fenech.

Endpoints in Mule are used to communitcate with other applications or mule instances. They are like message gateways through which events can be sent and received for more information see Mule Endpoints.

Configuration

Endpoints can be configured on Exception Strategies, routers and catch-all strategies. The <endpoint> elements represents the org.mule.umo.endpoint.UMOEndpoint class.
Lets start with a component example. the following configures one inbound and one outbound endpoint

<mule-descriptor name="test" implementation="org.foo. MyComponent">
    <inbound-router>
        <endpoint address="jms://my.queue"/>
    </inbound-router>
    <outbound-router>
        <router
         classname="org.mule.routing.outbound.OutboundPassThroughRouter">
            <endpoint address="smtp://[email protected]"/>
        </router>
    </outbound-router>
</mule-descriptor>

The most simple endpoint configuration just needs to provide an address. For more information about configuring components go here.

Attributes on the endpoint element are -

Attribute Description Required
addresss A valid Mule Endpoint URI or an endpoint-identifier, which is a friendly name mapping to a URI specified in the cinfiguration in the <endpoint-identifiers> element Yes
name An Identifying name for the endpoint No
connector The name of the specific connector to use for this endpoint. If this is not specified the connector is selected from the currently registered connectors or one is created if none of the configured connectors know how to handle the scheme on the address No
type Determines whether the endpoint provider is a sender, receiver or a senderAndReceiver. An endpoint can be senderAndReciever meaning that there is no difference for the endpoint configuration if it is used as a sender or receiver. This attribute only applies if the endpoint is a global endpoint.
transformers A space-separated list of transformer to use with this endpoint. These will transform data when it is received or sent by the UMO component (depending on whether this endpoint is a receiver or not). Connectors such as Jms have default inbound and outbound transformers, If this value is not set the default transformers on the connector will be used. No

Filters

A filter can be configured on an endpoint to filter inbound messages. The filter can be transport specific such as a Jms selector or file filter or can be a general filter such as using JXPath to filter on email messages. Filtering is not supported by all transports and setting a filter on an endpoint using some transports will result in an UnsupportedOperationException. See the Transports Guide for more information about filtering on a particular transport.
For more information about Filters see Filters.

Transactions

Thransaction element can be configured between two endpoints where the event processing between each is synchronous, this is controlled by setting the synchrous property on the connectors for each of the endpoints. For more information about configuring transactions go here.

Properties

Properties on endpoints can be used to customise behaviour for a particular endpoint instance. Any properties set on the endpoint can be used to overload properties on the connector. An example of this would be having an Smtp outbound endpoint and setting the fromAddress. See Configuring Properties for more information about how various property types can be used.

Global Endpoints

Global endpoints are configured Endpoints that are registered with the MuleManager. This means any object in Mule can make use of these endpoints. When you reference a global endpoint Mule actually returns a clone of the Endpoint. This allows client code to change any attibutes on the endpoint without affecting other objects in the system that also use the endpoint.
To configure a gloal endpoint in the Mule Xml configuration use the following -

<mule-configuration>
    <global-endpoints>
        <endpoint name="ExceptionQueue" address="jms://exception.queue"/>
    <global-endpoints>
    ....
<mule-configuration>

A clone of this endpoint can be obtained in code using -

UMOEndpoint endpoint = MuleManager.getInstance().lookupEndpoint("ExceptionQueue");

To reference a global endpoint in the configuration you use the <global-endpoint> element. The only attibutes that can be set on this element are -

  • name - The name of the global endpoint to use.
  • address - an URI string that will override the address configured on the endpoint

You can also set properties, transactions and filters on the referenced endpoint and these will override the values set on the global endpoint.
To use the global ExceptionQueue endpoint as the catch all endpoint on our router do the following -

<mule-descriptor name="test" implementation="org.foo. MyComponent">

    <outbound-router>
        <catch-all-strategy className="org.mule.routing.inbound.ForwardingCatchAllStrategy">
            <global-endpoint name="ExceptionQueue"/>
        </catch-all-strategy>
        <router
         classname="org.mule.routing.outbound.OutboundPassthroughRouter">
            <endpoint address="smtp://[email protected]"/>
        </router>
    </outbound-router>
</mule-descriptor>

Endpoint Identifiers

Endpoint identifiers can be used to map logical names to endpoint URIs. These identifiers can be used in place of the actual URI in the configuration and in code. This allows you to define all your endpoint URIs in one location which can be very useful when you move Mule instances between environments.

<mule-configuration>
    <endpoint-identifiers>
        <endpoint-identifier name="Component1Inbound" value="jms://in.queue"/>
        <endpoint-identifier name="Component1Outbound" value="jms://out.queue"/>
    <endpoint-identifiers>

    <model>
      <mule-descriptor name="Component1"
          inboundEndpoint="Component1Inbound"
          outboundEndpoint="Component1Outbound"
          implementation="com.foo.Component">
      </mule-descriptor>
    </model>
<mule-configuration>
Document generated by Confluence on Nov 27, 2006 10:27